//
//  KDCycleBannerViewCell.m
//  ForestPack
//
//  Created by 骆锴 on 2018/7/25.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "KDCycleBannerViewCell.h"
#import "SDCycleScrollView.h"
#import "Masonry.h"

@implementation KDCycleBannerViewCell 

+ (KDCycleBannerViewCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"NoticeCell";
    KDCycleBannerViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[KDCycleBannerViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.backgroundColor = [UIColor whiteColor];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        [cell createSubView];
    }
    
    return cell;
}

-(void)createSubView{
    UIView *view = [[UIView alloc] init];
    
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.width.equalTo(self.mas_width);
        make.height.equalTo(self.mas_height);
    }];
    
    SDCycleScrollView  * scrollView = [[SDCycleScrollView alloc] init];
    scrollView.backgroundColor = UIColorFromRGB(@"E6E6E6", 1);
    scrollView.currentPageDotColor = RGB_COLOR(237,34,59);
    scrollView.pageDotColor = RGB_COLOR(238,238,238);
    //    [scrollView setCurrentPageDotImage:[UIImage imageNamed:@"轮播圈红色"]];
    scrollView.showPageControl = YES;
    scrollView.autoScrollTimeInterval = 4.0;
    //    NSMutableArray *photoArray = [NSMutableArray array];
    //    scrollView.imageURLStringsGroup = array;
    NSArray *array = @[[UIImage imageNamed:@"商品背景图"],[UIImage imageNamed:@"商品背景图"],[UIImage imageNamed:@"商品背景图"],[UIImage imageNamed:@"商品背景图"]];
    scrollView.localizationImageNamesGroup = array;
    scrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    scrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
    scrollView.delegate = self;
    [view addSubview:scrollView];
    [scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.top.equalTo(self.mas_top);
        make.width.equalTo(self.mas_width);
        make.height.equalTo(@190);
    }];
    
    [self addSubview:view];
}
@end
